home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17570 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1022 b 

  1. Path: news.nbnet.nb.ca!news
  2. From: rwb2@mtt.ca (Rick Bruce)
  3. Newsgroups: comp.lang.c,comp.lang.c++
  4. Subject: Re: sizeof() question >>> :)
  5. Date: 16 Apr 1996 15:12:27 GMT
  6. Organization: NBNet
  7. Message-ID: <4l0dcr$14t0@darwin.nbnet.nb.ca>
  8. References: <1996Apr12.061927@topaz> <31714828.1574068@news.linex.com>
  9. Reply-To: rwb2@mtt.ca (Rick Bruce)
  10. NNTP-Posting-Host: guardian.mtt.ca
  11. X-Newsreader: IBM NewsReader/2 v1.2
  12.  
  13. In <31714828.1574068@news.linex.com>, mfried@linex.com (Marty Fried) writes:
  14. >Once upon a time (OK, it was 12 Apr 96 06:19:27 +1000),
  15. >naderr@topaz.cqu.edu.au wrote:
  16. >
  17. >>Hi,
  18. >>
  19. >>How can I get, with a pointer,  the sizeof  of an  array that is
  20. >>pointed by the pointer ?  (No it's not a tounge twister :)
  21. >>
  22. >>  while (!done) {
  23. >>    ch = getchar();
  24. >>    if (cp - *ct < sizeof(XXXXXXX)-1) {
  25. >>      *cp++ = ch;
  26. >>    } else {
  27. >>      beep();
  28. >>    }  
  29. >>  }
  30. >
  31. > If you allocate the space for the array you can call one of the memory
  32. > routines which return the size of the allocation.
  33. > Dave Gaudet via Rick Bruce
  34.  
  35.